﻿module Sustainalytics.Common {

    export interface IModal {
        open: (options: IModalOptions) => IModalInstance;
        name: string;
    };

    export interface IModalOptions {

        templateUrl?: string;
        template?: string;
        /**
        * A scope instance to be used for the modal's content (actually the $modal service is going to create a child scope of a provided scope).
        * Defaults to $rootScope 
        **/
        scope?: any;
        /**
        *A controller for a modal instance - it can initialize scope used by modal. Accepts the "controller-as" syntax, and can be injected with $modalInstance
        **/
        controller: any;

        /**
        *members that will be resolved and passed to the controller as locals; it is equivalent of the resolve property for AngularJS routes
        **/
        resolve?: any;

        size: string;
        /**
        *Controls presence of a backdrop.
        *Allowed values: true (default), false(no backdrop), 'static' - backdrop is present but modal window is not closed when clicking outside of the modal window.
        **/
        backdrop?: any;

        /**
        * Used for cancelling keyboard events.
        **/
        keyboard?: any;
    };

    export interface IModalInstance {
        close: (result: any) => void;
        dismiss: (result: any) => void;
        result: ng.IPromise<any>;
    };
}